
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Date · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Date.html" />
    
    
    <link rel="prev" href="Basic.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="Getting-Started.html">
            
                <a href="Getting-Started.html">
            
                    
                    开始 & 安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html">
            
                    
                    数据模板
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#数据模板定义规范-dtd">
            
                    
                    数据模板定义规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#1-属性值是字符串-string">
            
                    
                    String
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#2-属性值是数字-number">
            
                    
                    Number
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#3-属性值是布尔型-boolean">
            
                    
                    Boolean
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#4-属性值是对象-object">
            
                    
                    Object
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#5-属性值是数组-array">
            
                    
                    Array
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#6-属性值是函数-function">
            
                    
                    Function
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#7-属性值是正则表达式-regexp">
            
                    
                    RegExp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="Syntax-Specification.html">
            
                <a href="Syntax-Specification.html#数据占位符定义规范-dtd">
            
                    
                    数据占位符定义规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="Mock.mock.html">
            
                <a href="Mock.mock.html">
            
                    
                    Mock.mock()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="Mock.setup.html">
            
                <a href="Mock.setup.html">
            
                    
                    Mock.setup()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="Mock.Random.html">
            
                <a href="Mock.Random.html">
            
                    
                    Mock.Random()
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="Basic.html">
            
                <a href="Basic.html">
            
                    
                    Basic
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1.1" data-path="Basic.html">
            
                <a href="Basic.html#randomboolean-min-max-current-">
            
                    
                    boolean
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.2" data-path="Basic.html">
            
                <a href="Basic.html#randomnatural-min-max-">
            
                    
                    natural
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.3" data-path="Basic.html">
            
                <a href="Basic.html#randominteger-min-max-">
            
                    
                    integer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.4" data-path="Basic.html">
            
                <a href="Basic.html#randomfloat-min-max-dmin-dmax-">
            
                    
                    float
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.5" data-path="Basic.html">
            
                <a href="Basic.html#randomcharacter-pool-">
            
                    
                    character
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.6" data-path="Basic.html">
            
                <a href="Basic.html#randomstring-pool-min-max-">
            
                    
                    string
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.1.7" data-path="Basic.html">
            
                <a href="Basic.html#randomrange-start-stop-step-">
            
                    
                    range
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="1.6.2" data-path="Date.html">
            
                <a href="Date.html">
            
                    
                    Date
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.1" data-path="Date.html">
            
                <a href="Date.html#randomdate-format-">
            
                    
                    date
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.2" data-path="Date.html">
            
                <a href="Date.html#randomtime-format-">
            
                    
                    timeDate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.3" data-path="Date.html">
            
                <a href="Date.html#randomdatetime-format-">
            
                    
                    datetime
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.4" data-path="Date.html">
            
                <a href="Date.html#randomnow-unit-format-">
            
                    
                    now
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="Image.html">
            
                <a href="Image.html">
            
                    
                    Image
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.3.1" data-path="Image.html">
            
                <a href="Image.html">
            
                    
                    img
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3.2" data-path="Image.html">
            
                <a href="Image.html">
            
                    
                    dataImage
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="Color.html">
            
                <a href="Color.html">
            
                    
                    Color
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.4.1" data-path="Color.html">
            
                <a href="Color.html#randomcolor">
            
                    
                    color
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.2" data-path="Color.html">
            
                <a href="Color.html#randomhex">
            
                    
                    hex
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.3" data-path="Color.html">
            
                <a href="Color.html#randomrgb">
            
                    
                    rgb
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4.4" data-path="Color.html">
            
                <a href="Color.html#randomhsl">
            
                    
                    hsl
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="Text.html">
            
                <a href="Text.html">
            
                    
                    Text
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.5.1" data-path="Text.html">
            
                <a href="Text.html#randomparagraph-min-max-">
            
                    
                    paragraph
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.2" data-path="Text.html">
            
                <a href="Text.html#randomsentence-min-max-">
            
                    
                    sentence
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.3" data-path="Text.html">
            
                <a href="Text.html#randomword-min-max-">
            
                    
                    word
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.4" data-path="Text.html">
            
                <a href="Text.html#randomtitle-min-max-">
            
                    
                    title
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.5" data-path="Text.html">
            
                <a href="Text.html#randomcparagraph-min-max-">
            
                    
                    cparagraph
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.6" data-path="Text.html">
            
                <a href="Text.html#randomcsentence-min-max-">
            
                    
                    csentence
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.7" data-path="Text.html">
            
                <a href="Text.html#randomcword-pool-min-max-">
            
                    
                    cword
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5.8" data-path="Text.html">
            
                <a href="Text.html#randomctitle-min-max-">
            
                    
                    ctitlec
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="Name.html">
            
                <a href="Name.html">
            
                    
                    Name
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="Web.html">
            
                <a href="Web.html">
            
                    
                    Web
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="Address.html">
            
                <a href="Address.html">
            
                    
                    Address
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="Helper.html">
            
                <a href="Helper.html">
            
                    
                    Helper
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="Miscellaneous.html">
            
                <a href="Miscellaneous.html">
            
                    
                    Miscellaneous
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="Mock.valid.html">
            
                <a href="Mock.valid.html">
            
                    
                    Mock.valid()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="Mock.toJSONSchema.html">
            
                <a href="Mock.toJSONSchema.html">
            
                    
                    Mock.toJSONSchema()
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="Thanks-&-Contributors.html">
            
                <a href="Thanks-&-Contributors.html">
            
                    
                    感谢 & 贡献者
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Date</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <!-- ## Date -->
<h2 id="randomdate-format-">Random.date( format? )</h2>
<ul>
<li>Random.date()</li>
<li>Random.date(format)</li>
</ul>
<p>&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x968F;&#x673A;&#x7684;&#x65E5;&#x671F;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<!-- **参数的含义和默认值**如下所示： -->
<h3 id="format">format</h3>
<p>&#x53EF;&#x9009;&#x3002;</p>
<p>&#x6307;&#x793A;&#x751F;&#x6210;&#x7684;&#x65E5;&#x671F;&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x683C;&#x5F0F;&#x3002;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; <code>yyyy-MM-dd</code>&#x3002;</p>
<p>&#x53EF;&#x9009;&#x7684;&#x5360;&#x4F4D;&#x7B26;&#x53C2;&#x8003;&#x81EA; <a href="http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date" target="_blank">Ext.Date</a>&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>Format</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>yyyy</td>
<td>A full numeric representation of a year, 4 digits</td>
<td>1999 or 2003</td>
</tr>
<tr>
<td>yy</td>
<td>A two digit representation of a year</td>
<td>99 or 03</td>
</tr>
<tr>
<td>y</td>
<td>A two digit representation of a year</td>
<td>99 or 03</td>
</tr>
<tr>
<td>MM</td>
<td>Numeric representation of a month, with leading zeros</td>
<td>01 to 12</td>
</tr>
<tr>
<td>M</td>
<td>Numeric representation of a month, without leading zeros</td>
<td>1 to 12</td>
</tr>
<tr>
<td>dd</td>
<td>Day of the month, 2 digits with leading zeros</td>
<td>01 to 31</td>
</tr>
<tr>
<td>d</td>
<td>Day of the month without leading zeros</td>
<td>1 to 31</td>
</tr>
<tr>
<td>HH</td>
<td>24-hour format of an hour with leading zeros</td>
<td>00 to 23</td>
</tr>
<tr>
<td>H</td>
<td>24-hour format of an hour without leading zeros</td>
<td>0 to 23</td>
</tr>
<tr>
<td>hh</td>
<td>12-hour format of an hour without leading zeros</td>
<td>1 to 12</td>
</tr>
<tr>
<td>h</td>
<td>12-hour format of an hour with leading zeros</td>
<td>01 to 12</td>
</tr>
<tr>
<td>mm</td>
<td>Minutes, with leading zeros</td>
<td>00 to 59</td>
</tr>
<tr>
<td>m</td>
<td>Minutes, without leading zeros</td>
<td>0 to 59</td>
</tr>
<tr>
<td>ss</td>
<td>Seconds, with leading zeros</td>
<td>00 to 59</td>
</tr>
<tr>
<td>s</td>
<td>Seconds, without leading zeros</td>
<td>0 to 59</td>
</tr>
<tr>
<td>SS</td>
<td>Milliseconds, with leading zeros</td>
<td>000 to 999</td>
</tr>
<tr>
<td>S</td>
<td>Milliseconds, without leading zeros</td>
<td>0 to 999</td>
</tr>
<tr>
<td>A</td>
<td>Uppercase Ante meridiem and Post meridiem</td>
<td>AM or PM</td>
</tr>
<tr>
<td>a</td>
<td>Lowercase Ante meridiem and Post meridiem</td>
<td>am or pm</td>
</tr>
<tr>
<td>T</td>
<td>Milliseconds, since 1970-1-1 00:00:00 UTC</td>
<td>759883437303</td>
</tr>
</tbody>
</table>
<!-- **使用示例**如下所示： -->
<pre><code class="lang-js">Random.date()
<span class="hljs-comment">// =&gt; &quot;2002-10-23&quot;</span>
Random.date(<span class="hljs-string">&apos;yyyy-MM-dd&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;1983-01-29&quot;</span>
Random.date(<span class="hljs-string">&apos;yy-MM-dd&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;79-02-14&quot;</span>
Random.date(<span class="hljs-string">&apos;y-MM-dd&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;81-05-17&quot;</span>
Random.date(<span class="hljs-string">&apos;y-M-d&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;84-6-5&quot;</span>
</code></pre>
<h2 id="randomtime-format-">Random.time( format? )</h2>
<ul>
<li>Random.time()</li>
<li>Random.time( format )</li>
</ul>
<p>&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x968F;&#x673A;&#x7684;&#x65F6;&#x95F4;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<!-- **参数的含义和默认值**如下所示： -->
<h3 id="format">format</h3>
<p>&#x53EF;&#x9009;&#x3002;</p>
<p>&#x6307;&#x793A;&#x751F;&#x6210;&#x7684;&#x65F6;&#x95F4;&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x683C;&#x5F0F;&#x3002;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; <code>HH:mm:ss</code>&#x3002;</p>
<blockquote>
<p>&#x53EF;&#x9009;&#x7684;&#x5360;&#x4F4D;&#x7B26;&#x53C2;&#x8003;&#x81EA; <a href="http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date" target="_blank">Ext.Date</a>&#xFF0C;&#x8BF7;&#x53C2;&#x89C1; Random.date( format? )&#x3002;</p>
</blockquote>
<!-- **使用示例**如下所示： -->
<pre><code class="lang-js">Random.time()
<span class="hljs-comment">// =&gt; &quot;00:14:47&quot;</span>
Random.time(<span class="hljs-string">&apos;A HH:mm:ss&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;PM 20:47:37&quot;</span>
Random.time(<span class="hljs-string">&apos;a HH:mm:ss&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;pm 17:40:00&quot;</span>
Random.time(<span class="hljs-string">&apos;HH:mm:ss&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;03:57:53&quot;</span>
Random.time(<span class="hljs-string">&apos;H:m:s&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;3:5:13&quot;</span>
</code></pre>
<h2 id="randomdatetime-format-">Random.datetime( format? )</h2>
<ul>
<li>Random.datetime()</li>
<li>Random.datetime( format )</li>
</ul>
<p>&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x968F;&#x673A;&#x7684;&#x65E5;&#x671F;&#x548C;&#x65F6;&#x95F4;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<!-- **参数的含义和默认值**如下所示： -->
<h3 id="format">format</h3>
<p>&#x53EF;&#x9009;&#x3002;</p>
<p>&#x6307;&#x793A;&#x751F;&#x6210;&#x7684;&#x65E5;&#x671F;&#x548C;&#x65F6;&#x95F4;&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x683C;&#x5F0F;&#x3002;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; <code>yyyy-MM-dd HH:mm:ss</code>&#x3002;</p>
<blockquote>
<p>&#x53EF;&#x9009;&#x7684;&#x5360;&#x4F4D;&#x7B26;&#x53C2;&#x8003;&#x81EA; <a href="http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date" target="_blank">Ext.Date</a>&#xFF0C;&#x8BF7;&#x53C2;&#x89C1; Random.date( format? )&#x3002;</p>
</blockquote>
<!-- **使用示例**如下所示： -->
<pre><code class="lang-js">Random.datetime()
<span class="hljs-comment">// =&gt; &quot;1977-11-17 03:50:15&quot;</span>
Random.datetime(<span class="hljs-string">&apos;yyyy-MM-dd A HH:mm:ss&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;1976-04-24 AM 03:48:25&quot;</span>
Random.datetime(<span class="hljs-string">&apos;yy-MM-dd a HH:mm:ss&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;73-01-18 pm 22:12:32&quot;</span>
Random.datetime(<span class="hljs-string">&apos;y-MM-dd HH:mm:ss&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;79-06-24 04:45:16&quot;</span>
Random.datetime(<span class="hljs-string">&apos;y-M-d H:m:s&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;02-4-23 2:49:40&quot;</span>
</code></pre>
<h2 id="randomnow-unit-format-">Random.now( unit?, format? )</h2>
<ul>
<li>Ranndom.now( unit, format )</li>
<li>Ranndom.now()</li>
<li>Ranndom.now( format )</li>
<li>Ranndom.now( unit )</li>
</ul>
<p>&#x8FD4;&#x56DE;&#x5F53;&#x524D;&#x7684;&#x65E5;&#x671F;&#x548C;&#x65F6;&#x95F4;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<!-- **参数的含义和默认值**如下所示： -->
<h3 id="unit">unit</h3>
<p>&#x53EF;&#x9009;&#x3002;</p>
<p>&#x8868;&#x793A;&#x65F6;&#x95F4;&#x5355;&#x4F4D;&#xFF0C;&#x7528;&#x4E8E;&#x5BF9;&#x5F53;&#x524D;&#x65E5;&#x671F;&#x548C;&#x65F6;&#x95F4;&#x8FDB;&#x884C;&#x683C;&#x5F0F;&#x5316;&#x3002;&#x53EF;&#x9009;&#x503C;&#x6709;&#xFF1A;<code>year</code>&#x3001;<code>month</code>&#x3001;<code>week</code>&#x3001;<code>day</code>&#x3001;<code>hour</code>&#x3001;<code>minute</code>&#x3001;<code>second</code>&#x3001;<code>week</code>&#xFF0C;&#x9ED8;&#x8BA4;&#x4E0D;&#x4F1A;&#x683C;&#x5F0F;&#x5316;&#x3002;</p>
<h3 id="format">format</h3>
<p>&#x53EF;&#x9009;&#x3002;</p>
<p>&#x6307;&#x793A;&#x751F;&#x6210;&#x7684;&#x65E5;&#x671F;&#x548C;&#x65F6;&#x95F4;&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x683C;&#x5F0F;&#x3002;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A; <code>yyyy-MM-dd HH:mm:ss</code>&#x3002;&#x53EF;&#x9009;&#x7684;&#x5360;&#x4F4D;&#x7B26;&#x53C2;&#x8003;&#x81EA; <a href="http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date" target="_blank">Ext.Date</a>&#xFF0C;&#x8BF7;&#x53C2;&#x89C1; <a href="#date">Random.date(format)</a>&#x3002;</p>
<blockquote>
<p><code>Random.now()</code> &#x7684;&#x5B9E;&#x73B0;&#x53C2;&#x8003;&#x4E86; <a href="http://momentjs.cn/docs/#/manipulating/start-of/" target="_blank">Moment.js</a>&#x3002;</p>
</blockquote>
<!-- **使用示例**如下所示： -->
<pre><code class="lang-js">Random.now()
<span class="hljs-comment">// =&gt; &quot;2014-04-29 20:08:38 &quot;</span>
Random.now(<span class="hljs-string">&apos;day&apos;</span>, <span class="hljs-string">&apos;yyyy-MM-dd HH:mm:ss SS&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-29 00:00:00 000&quot;</span>
Random.now(<span class="hljs-string">&apos;day&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-29 00:00:00 &quot;</span>
Random.now(<span class="hljs-string">&apos;yyyy-MM-dd HH:mm:ss SS&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-29 20:08:38 157&quot;</span>

Random.now(<span class="hljs-string">&apos;year&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-01-01 00:00:00&quot;</span>
Random.now(<span class="hljs-string">&apos;month&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-01 00:00:00&quot;</span>
Random.now(<span class="hljs-string">&apos;week&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-27 00:00:00&quot;</span>
Random.now(<span class="hljs-string">&apos;day&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-29 00:00:00&quot;</span>
Random.now(<span class="hljs-string">&apos;hour&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-29 20:00:00&quot;</span>
Random.now(<span class="hljs-string">&apos;minute&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-29 20:08:00&quot;</span>
Random.now(<span class="hljs-string">&apos;second&apos;</span>)
<span class="hljs-comment">// =&gt; &quot;2014-04-29 20:08:38&quot;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Basic.html#randomrange-start-stop-step-" class="navigation navigation-prev " aria-label="Previous page: range">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Date.html#randomdate-format-" class="navigation navigation-next " aria-label="Next page: date">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Date","level":"1.6.2","depth":2,"next":{"title":"date","level":"1.6.2.1","depth":3,"anchor":"#randomdate-format-","path":"Date.md","ref":"./Date.md#randomdate-format-","articles":[]},"previous":{"title":"range","level":"1.6.1.7","depth":3,"anchor":"#randomrange-start-stop-step-","path":"Basic.md","ref":"./Basic.md#randomrange-start-stop-step-","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"Date.md","mtime":"2019-01-02T03:55:46.259Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-01-02T04:01:33.354Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

